<template>
	<view class="content">
		<view class="flex flex-col list-box">
			<view class="list-item flex items-center">
				<text class="flex-1">日期</text>
				<text class="flex-1">金额</text>
				<text class="flex-1">状态</text>
			</view>
			<text class="empty" v-if="!list.length">暂无数据</text>
			<view class="list-item flex items-center" v-for="e, i in list" :key="i">
				<text class="flex-1">{{dayjs(e.addtime).format('YYYY-MM-DD HH:mm:ss')}}</text>
				<text class="flex-1">{{e.amount}}</text>
				<text class="flex-1" v-if="e.sts">已支付</text>
				<text class="flex-1" style="color: orange;" v-else>审核中</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import config from '../../config/index.js'
	import dayjs from 'dayjs'
	
	const list = ref([])
	
	onLoad(_options => {
		GetList(_options.id)
	})
	
	function GetList(id) {
		uni.request({
			url: config.baseUrl + '/app/anchorgetCashmanagelist',
			method: 'POST',
			header: {
				"Content-Type": "application/x-www-form-urlencoded"
			},
			data: {
				'anchor.id': id
			},
			success: (res) => {
				let {
					data: resData
				} = res
				let {
					code,
					data
				} = resData
				list.value = data
			}
		})
	}
</script>

<style>
	.content {
		padding: 20rpx 20rpx 60rpx;
	}
	
	.list-box {
		background: #fff;
		padding: 20rpx;
		border-radius: 20rpx;
	}
	
	.list-item {
		border-bottom: 1px solid #e8e8e8;
		font-size: 28rpx;
		text-align: center;
	}
	
	.list-item text {
		padding: 20rpx 0;
	}
	
	.list-item:nth-last-child(1) {
		border-bottom: none;
	}
	
	.empty {
		font-size: 26rpx;
		color: #c2c2c2;
		text-align: center;
		padding-top: 20rpx;
	}
</style>
